#pragma once

#include "Structures.h"

#include <D3D11.h>
#include <D3DX11.h>
#include <D3DX10.h>

#include <vector>

#pragma comment (lib, "D3D11.lib")
#pragma comment (lib, "D3DX11.lib")
#pragma comment (lib, "D3DX10.lib")


namespace Proton 
{
	namespace Managers
	{
		class PScheduler;
		class PlatformManager;

		class GraphicsManager
		{
			PlatformManager* pPlatform;
			PScheduler* pScheduler;

			GRAPHICS_SETTINGS_DESC gsd;

			D3D_FEATURE_LEVEL featureLevel;

			IDXGISwapChain *swapchain;
			ID3D11Device *dev;
			ID3D11DeviceContext *devcon;
			ID3D11RenderTargetView *backbuffer;

			std::vector<IDXGIAdapter*> adapters;

			HWND windowHandle;

			bool initialized;

			void initD3D();
			void cleanD3D(void);
		public:
			GraphicsManager(GRAPHICS_SETTINGS_DESC *pGsd);
			virtual ~GraphicsManager(void);

			void initialize(PlatformManager* _pPlatform, PScheduler* _pScheduler);

			unsigned int getWindowHeight() const { return gsd.windowHeight; };
			unsigned int getWindowWidth() const { return gsd.windowWidth; };
			unsigned int getMsCount() const { return gsd.msCount; };
			bool getIsFullscreen() const { return gsd.fullscreen; };

			ID3D11DeviceContext* getDeviceContext() { return devcon; };
			IDXGISwapChain* getSwapChain() { return swapchain; };
			ID3D11RenderTargetView* getBackBuffer() { return backbuffer; };

		};
	}
}

